package com.example.minzhengtong.ui.add

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.example.minzhengtong.Const
import com.example.minzhengtong.R
import com.example.minzhengtong.base.BaseA
import com.example.minzhengtong.databinding.ActivityEnterInfoSearchBinding
import com.example.minzhengtong.utils.LogUtil

/**
 * created by WY on 2021/6/18.
 * 医保参保信息查询
 */
class EnterInfoSearchA : BaseA(){

    companion object{
        fun enterThis(context: Context){
            val intent = Intent(context, EnterInfoSearchA::class.java)
            context.startActivity(intent)
        }
    }

    private lateinit var binding : ActivityEnterInfoSearchBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityEnterInfoSearchBinding.inflate(layoutInflater)
        overridePendingTransition(0,0)
        setContentView(binding.root)
        setToolBarVisiabale(false)
        initImmerBar(true,R.id.title_bar)

        binding.webview.loadUrl("${Const.waterMark}福建医保")

        val showZjhm = StringBuilder()
        LogUtil.d("展示证件号码${userBean!!.data!!.zjhm!!}")
        showZjhm.append(userBean!!.data!!.zjhm!!.substring(0,2))
        for (i in userBean!!.data!!.zjhm!!.indices-5){
            showZjhm.append("*")
        }
        if (showZjhm.length > 5){
            showZjhm.delete(showZjhm.length-4,showZjhm.length)
        }
        showZjhm.append(userBean!!.data!!.zjhm!!.substring(userBean!!.data!!.zjhm!!.length-3))
        if (userBean!!.data!!.zjhm!!.length > 5){
            binding.zjhm.text = showZjhm
        }else{
            binding.zjhm.text = userBean!!.data!!.zjhm!!
        }
        binding.address.text = userBean?.data?.city
        binding.company.text = userBean?.data?.company
        binding.balance.text = userBean?.data?.money

    }

    override fun finish() {
        super.finish()
        overridePendingTransition(0,0)
    }

}